package controller

import (
	"fx_swift_ifcgate_agent/internal/service"
	"fx_swift_ifcgate_agent/pkg/code"
	"fx_swift_ifcgate_agent/pkg/internalerrors"
	"github.com/gin-gonic/gin"
	"net/http"
)

func GetCountryInfo(c *gin.Context) {
	result, err := service.GetCountryInfo(c)
	if err != nil {
		code.Fail(c, http.StatusBadRequest, err.(internalerrors.ServiceError).Code, err.(internalerrors.ServiceError).Msg)
		return
	} else {
		code.Success(c, result)
	}
}

// 获取币种
func GetCurrencyInfo(c *gin.Context) {
	result, err := service.GetCurrencyInfo(c)
	if err != nil {
		code.Fail(c, http.StatusBadRequest, err.(internalerrors.ServiceError).Code, err.(internalerrors.ServiceError).Msg)
		return
	} else {
		code.Success(c, result)
	}
}

// 付款目的
func GetPurposeList(c *gin.Context) {
	result, err := service.GetPurposeList(c)
	if err != nil {
		code.Fail(c, http.StatusBadRequest, err.(internalerrors.ServiceError).Code, err.(internalerrors.ServiceError).Msg)
		return
	} else {
		code.Success(c, result)
	}
}
